package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.constant.MessageConstant;
import com.itheima.dao.MemberDao;
import com.itheima.dao.OrderDao;
import com.itheima.dao.OrderSettingDao;
import com.itheima.dao.OrderSettingListDao;
import com.itheima.entity.*;

import com.itheima.pojo.Member;
import com.itheima.pojo.Order;
import com.itheima.pojo.OrderSetting;
import com.itheima.pojo.Setmeal;
import com.itheima.service.OrderSettingListService;
import com.itheima.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;


import java.util.*;

@Service(interfaceClass = OrderSettingListService.class)
@Transactional
public class OrderSettingListServiceImpl implements OrderSettingListService {

    @Autowired
    private OrderSettingListDao orderSettingListDao;

    @Autowired
    private OrderSettingDao orderSettingDao;

    @Autowired
    private MemberDao memberDao;

    @Autowired
    private OrderDao orderDao;

    /**
     * 分页查询展示数据
     * @param queryString
     * @return
     */
    @Override
    public PageResult findPage(QueryString queryString) throws Exception{
        Integer pageSize = queryString.getPageSize();
        Integer currentPage = queryString.getCurrentPage();
        PageHelper.startPage(currentPage,pageSize);
        Page<OrderVo> mapPage = orderSettingListDao.findPage(queryString);
        return new PageResult(mapPage.getTotal(),mapPage.getResult());

    }

    /**
     * 查询所有套餐信息
     * @return
     */
    @Override
    public List<Setmeal> findAll() throws Exception{
        return orderSettingListDao.findAll();
    }
}
